﻿/*
 * EmeCoder v1.2.1.168
 * 作者：Administrator/PC4APPLE
 * 时间：2013-07-26 00:41:25
 * 版权：版权所有 (C) Eme Development Team 2013
*/

﻿using System;
using System.ComponentModel;
using HmFramework.Data;
using HmFramework.Data.Configuration;
using HmFramework.Data.DataAccessLayer;

namespace CuteSprite.Eme.Data.BsdUserCenter
{
	/// <summary>客户</summary>
	[Serializable]
	[DataObject]
	[Description("客户")]
	[BindIndex("IX_Customer_Name", false, "Name")]
	[BindIndex("IX_Customer_StaffID", false, "StaffID")]
	[BindIndex("IX_Customer_CreateUserID", false, "CreateUserID")]
	[BindIndex("PK_Customer", true, "ID")]
	[BindIndex("IX_Customer_OrganizeID", false, "OrganizeID")]
	[BindIndex("IX_Customer_BindUserID", false, "BindUserID")]
	[BindRelation("StaffID", false, "Staff", "ID")]
	[BindRelation("ID", true, "CustomerContact", "CustomerID")]
	[BindRelation("OrganizeID", false, "Organize", "ID")]
	[BindTable("Customer", Description = "客户", ConnName = "EmeUserCenter", DbType = DatabaseType.SqlServer)]
	[ModelCheckMode(ModelCheckModes.CheckTableWhenFirstUse)]
	public class BsdCustomer : Customer<BsdCustomer, BsdStaff, BsdAdministrator, BsdOrganize, BsdCustomerContact>
	{
		#region -- 属性 --

		private String _OtherAddress;

		/// <summary>其他地址</summary>
		[DisplayName("其他地址")]
		[Description("其他地址")]
		[DataObjectField(false, false, true, 200)]
		[BindColumn(51, "OtherAddress", "其他地址", null, "nvarchar(200)", 0, 0, true)]
		public virtual String OtherAddress
		{
			get { return _OtherAddress; }
			set { if (OnPropertyChanging(____.OtherAddress, value)) { _OtherAddress = value; OnPropertyChanged(____.OtherAddress); } }
		}

		private String _LogisticsDirection;

		/// <summary>物流方向</summary>
		[DisplayName("物流方向")]
		[Description("物流方向")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(52, "LogisticsDirection", "物流方向", null, "nvarchar(50)", 0, 0, true)]
		public virtual String LogisticsDirection
		{
			get { return _LogisticsDirection; }
			set { if (OnPropertyChanging(____.LogisticsDirection, value)) { _LogisticsDirection = value; OnPropertyChanged(____.LogisticsDirection); } }
		}

		private DateTime _FoundedDate;

		/// <summary>成立时间</summary>
		[DisplayName("成立时间")]
		[Description("成立时间")]
		[DataObjectField(false, false, true, 3)]
		[BindColumn(53, "FoundedDate", "成立时间", null, "datetime", 3, 0, false)]
		public virtual DateTime FoundedDate
		{
			get { return _FoundedDate; }
			set { if (OnPropertyChanging(____.FoundedDate, value)) { _FoundedDate = value; OnPropertyChanged(____.FoundedDate); } }
		}

		private DateTime _BusinessTermFrom;

		/// <summary>营业期限(开始)</summary>
		[DisplayName("营业期限开始")]
		[Description("营业期限(开始)")]
		[DataObjectField(false, false, true, 3)]
		[BindColumn(54, "BusinessTermFrom", "营业期限(开始)", null, "datetime", 3, 0, false)]
		public virtual DateTime BusinessTermFrom
		{
			get { return _BusinessTermFrom; }
			set { if (OnPropertyChanging(____.BusinessTermFrom, value)) { _BusinessTermFrom = value; OnPropertyChanged(____.BusinessTermFrom); } }
		}

		private DateTime _BusinessTermTo;

		/// <summary>营业期限(截至)</summary>
		[DisplayName("营业期限截至")]
		[Description("营业期限(截至)")]
		[DataObjectField(false, false, true, 3)]
		[BindColumn(55, "BusinessTermTo", "营业期限(截至)", null, "datetime", 3, 0, false)]
		public virtual DateTime BusinessTermTo
		{
			get { return _BusinessTermTo; }
			set { if (OnPropertyChanging(____.BusinessTermTo, value)) { _BusinessTermTo = value; OnPropertyChanged(____.BusinessTermTo); } }
		}

		private String _BusinessArea;

		/// <summary>营业面积</summary>
		[DisplayName("营业面积")]
		[Description("营业面积")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(56, "BusinessArea", "营业面积", null, "nvarchar(50)", 0, 0, true)]
		public virtual String BusinessArea
		{
			get { return _BusinessArea; }
			set { if (OnPropertyChanging(____.BusinessArea, value)) { _BusinessArea = value; OnPropertyChanged(____.BusinessArea); } }
		}

		private String _CustomerFeedback;

		/// <summary>客户意见</summary>
		[DisplayName("客户意见")]
		[Description("客户意见")]
		[DataObjectField(false, false, true, 800)]
		[BindColumn(57, "CustomerFeedback", "客户意见", null, "nvarchar(800)", 0, 0, true)]
		public virtual String CustomerFeedback
		{
			get { return _CustomerFeedback; }
			set { if (OnPropertyChanging(____.CustomerFeedback, value)) { _CustomerFeedback = value; OnPropertyChanged(____.CustomerFeedback); } }
		}

		private String _StaffAmount;
		/// <summary>员工人数</summary>
		[DisplayName("员工人数")]
		[Description("员工人数")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(58, "StaffAmount", "员工人数", null, "nvarchar(50)", 0, 0, true)]
		public virtual String StaffAmount
		{
			get { return _StaffAmount; }
			set { if (OnPropertyChanging(___.StaffAmount, value)) { _StaffAmount = value; OnPropertyChanged(___.StaffAmount); } }
		}

		private String _Assets;
		/// <summary>资产情况</summary>
		[DisplayName("资产情况")]
		[Description("资产情况")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(59, "Assets", "资产情况", null, "nvarchar(50)", 0, 0, true)]
		public virtual String Assets
		{
			get { return _Assets; }
			set { if (OnPropertyChanging(___.Assets, value)) { _Assets = value; OnPropertyChanged(___.Assets); } }
		}

		private String _PaymentCycle;
		/// <summary>结款周期</summary>
		[DisplayName("结款周期")]
		[Description("结款周期")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(60, "PaymentCycle", "结款周期", null, "nvarchar(50)", 0, 0, true)]
		public virtual String PaymentCycle
		{
			get { return _PaymentCycle; }
			set { if (OnPropertyChanging(___.PaymentCycle, value)) { _PaymentCycle = value; OnPropertyChanged(___.PaymentCycle); } }
		}

		private String _MonthlyAmount;
		/// <summary>月结算额</summary>
		[DisplayName("月结算额")]
		[Description("月结算额")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(61, "MonthlyAmount", "月结算额", null, "nvarchar(50)", 0, 0, true)]
		public virtual String MonthlyAmount
		{
			get { return _MonthlyAmount; }
			set { if (OnPropertyChanging(___.MonthlyAmount, value)) { _MonthlyAmount = value; OnPropertyChanged(___.MonthlyAmount); } }
		}

		private String _ManagerToAssess;
		/// <summary>区域经理评定</summary>
		[DisplayName("区域经理评定")]
		[Description("区域经理评定")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(62, "ManagerToAssess", "区域经理评定", null, "nvarchar(50)", 0, 0, true)]
		public virtual String ManagerToAssess
		{
			get { return _ManagerToAssess; }
			set { if (OnPropertyChanging(___.ManagerToAssess, value)) { _ManagerToAssess = value; OnPropertyChanged(___.ManagerToAssess); } }
		}

		private Int32 _InvoiceSituation;
		/// <summary>开票情况</summary>
		[DisplayName("开票情况")]
		[Description("开票情况")]
		[DataObjectField(false, false, true, 10)]
		[BindColumn(63, "InvoiceSituation", "开票情况", null, "int", 10, 0, false)]
		public virtual Int32 InvoiceSituation
		{
			get { return _InvoiceSituation; }
			set { if (OnPropertyChanging(___.InvoiceSituation, value)) { _InvoiceSituation = value; OnPropertyChanged(___.InvoiceSituation); } }
		}

		private Boolean _RewardSituation;
		/// <summary>奖励情况</summary>
		[DisplayName("奖励情况")]
		[Description("奖励情况")]
		[DataObjectField(false, false, true, 1)]
		[BindColumn(64, "RewardSituation", "奖励情况", null, "bit", 0, 0, false)]
		public virtual Boolean RewardSituation
		{
			get { return _RewardSituation; }
			set { if (OnPropertyChanging(___.RewardSituation, value)) { _RewardSituation = value; OnPropertyChanged(___.RewardSituation); } }
		}

		private String _TermsOfPayment;
		/// <summary>付款方式</summary>
		[DisplayName("付款方式")]
		[Description("付款方式")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(65, "TermsOfPayment", "付款方式", null, "nvarchar(50)", 0, 0, true)]
		public virtual String TermsOfPayment
		{
			get { return _TermsOfPayment; }
			set { if (OnPropertyChanging(___.TermsOfPayment, value)) { _TermsOfPayment = value; OnPropertyChanged(___.TermsOfPayment); } }
		}

		private String _SalesmanComments;
		/// <summary>经办业务员点评</summary>
		[DisplayName("经办业务员点评")]
		[Description("经办业务员点评")]
		[DataObjectField(false, false, true, 800)]
		[BindColumn(66, "SalesmanComments", "经办业务员点评", null, "nvarchar(800)", 0, 0, true)]
		public virtual String SalesmanComments
		{
			get { return _SalesmanComments; }
			set { if (OnPropertyChanging(___.SalesmanComments, value)) { _SalesmanComments = value; OnPropertyChanged(___.SalesmanComments); } }
		}
		private String _CustomerAgreement;
		/// <summary>客户协议备案情况</summary>
		[DisplayName("客户协议备案情况")]
		[Description("客户协议备案情况")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(67, "CustomerAgreement", "客户协议备案情况", null, "nvarchar(50)", 0, 0, true)]
		public virtual String CustomerAgreement
		{
			get { return _CustomerAgreement; }
			set { if (OnPropertyChanging(___.CustomerAgreement, value)) { _CustomerAgreement = value; OnPropertyChanged(___.CustomerAgreement); } }
		}

		private Int32 _SettlementSolutionID;
		/// <summary>公布价方案</summary>
		[DisplayName("公布价方案")]
		[Description("公布价方案")]
		[DataObjectField(false, false, true, 10)]
		[BindColumn(68, "SettlementSolutionID", "公布价方案", null, "int", 10, 0, false)]
		public virtual Int32 SettlementSolutionID
		{
			get { return _SettlementSolutionID; }
			set { if (OnPropertyChanging(___.SettlementSolutionID, value)) { _SettlementSolutionID = value; OnPropertyChanged(___.SettlementSolutionID); } }
		}

		private SByte _SettlementDiscount;
		/// <summary>结算折扣</summary>
		[DisplayName("结算折扣")]
		[Description("结算折扣")]
		[DataObjectField(false, false, true, 3)]
		[BindColumn(69, "SettlementDiscount", "结算折扣", null, "tinyint", 3, 0, false)]
		public virtual SByte SettlementDiscount
		{
			get { return _SettlementDiscount; }
			set { if (OnPropertyChanging(___.SettlementDiscount, value)) { _SettlementDiscount = value; OnPropertyChanged(___.SettlementDiscount); } }
		}

		private String _NameEN2;
		/// <summary>客户英文名称2</summary>
		[DisplayName("客户英文名称2")]
		[Description("客户英文名称2")]
		[DataObjectField(false, false, true, 50)]
		[BindColumn(70, "NameEN2", "客户英文名称2", null, "nvarchar(50)", 0, 0, true)]
		public virtual String NameEN2
		{
			get { return _NameEN2; }
			set { if (OnPropertyChanging(___.NameEN2, value)) { _NameEN2 = value; OnPropertyChanged(___.NameEN2); } }
		}

		#endregion 属性

		#region -- 获取/设置 字段值 --

		/// <summary>
		/// 获取/设置 字段值。
		/// 一个索引，基类使用反射实现。
		/// 派生实体类可重写该索引，以避免反射带来的性能损耗
		/// </summary>
		/// <param name="name">字段名</param>
		/// <returns></returns>
		public override Object this[String name]
		{
			get
			{
				switch (name)
				{
					case ____.OtherAddress: return _OtherAddress;
					case ____.LogisticsDirection: return _LogisticsDirection;
					case ____.FoundedDate: return _FoundedDate;
					case ____.BusinessTermFrom: return _BusinessTermFrom;
					case ____.BusinessTermTo: return _BusinessTermTo;
					case ____.BusinessArea: return _BusinessArea;
					case ____.CustomerFeedback: return _CustomerFeedback;
					case ____.StaffAmount: return _StaffAmount;
					case ____.Assets: return _Assets;
					case ____.PaymentCycle: return _PaymentCycle;
					case ____.MonthlyAmount: return _MonthlyAmount;
					case ____.ManagerToAssess: return _ManagerToAssess;
					case ____.InvoiceSituation: return _InvoiceSituation;
					case ____.RewardSituation: return _RewardSituation;
					case ____.TermsOfPayment: return _TermsOfPayment;
					case ____.SalesmanComments: return _SalesmanComments;
					case ____.CustomerAgreement: return _CustomerAgreement;
					case ____.SettlementSolutionID: return _SettlementSolutionID;
					case ____.SettlementDiscount: return _SettlementDiscount;
					case ____.NameEN2: return _NameEN2;
					default: return base[name];
				}
			}
			set
			{
				switch (name)
				{
					case ____.OtherAddress: _OtherAddress = Convert.ToString(value); break;
					case ____.LogisticsDirection: _LogisticsDirection = Convert.ToString(value); break;
					case ____.FoundedDate: _FoundedDate = Convert.ToDateTime(value); break;
					case ____.BusinessTermFrom: _BusinessTermFrom = Convert.ToDateTime(value); break;
					case ____.BusinessTermTo: _BusinessTermTo = Convert.ToDateTime(value); break;
					case ____.BusinessArea: _BusinessArea = Convert.ToString(value); break;
					case ____.CustomerFeedback: _CustomerFeedback = Convert.ToString(value); break;
					case ____.StaffAmount: _StaffAmount = Convert.ToString(value); break;
					case ____.Assets: _Assets = Convert.ToString(value); break;
					case ____.PaymentCycle: _PaymentCycle = Convert.ToString(value); break;
					case ____.MonthlyAmount: _MonthlyAmount = Convert.ToString(value); break;
					case ____.ManagerToAssess: _ManagerToAssess = Convert.ToString(value); break;
					case ____.InvoiceSituation: _InvoiceSituation = Convert.ToInt32(value); break;
					case ____.RewardSituation: _RewardSituation = Convert.ToBoolean(value); break;
					case ____.TermsOfPayment: _TermsOfPayment = Convert.ToString(value); break;
					case ____.SalesmanComments: _SalesmanComments = Convert.ToString(value); break;
					case ____.CustomerAgreement: _CustomerAgreement = Convert.ToString(value); break;
					case ____.SettlementSolutionID: _SettlementSolutionID = Convert.ToInt32(value); break;
					case ____.SettlementDiscount: _SettlementDiscount = Convert.ToSByte(value); break;
					case ____.NameEN2: _NameEN2 = Convert.ToString(value); break;
					default: base[name] = value; break;
				}
			}
		}

		#endregion 获取/设置 字段值

		#region -- 字段名 --

		/// <summary>取得客户字段信息的快捷方式</summary>
		public partial class ___ : _
		{
			///<summary>其他地址</summary>
			public static readonly Field OtherAddress = FindByName(____.OtherAddress);

			///<summary>物流方向</summary>
			public static readonly Field LogisticsDirection = FindByName(____.LogisticsDirection);

			///<summary>成立时间</summary>
			public static readonly Field FoundedDate = FindByName(____.FoundedDate);

			///<summary>营业期限(开始)</summary>
			public static readonly Field BusinessTermFrom = FindByName(____.BusinessTermFrom);

			///<summary>营业期限(截至)</summary>
			public static readonly Field BusinessTermTo = FindByName(____.BusinessTermTo);

			///<summary>营业面积</summary>
			public static readonly Field BusinessArea = FindByName(____.BusinessArea);

			///<summary>客户意见</summary>
			public static readonly Field CustomerFeedback = FindByName(____.CustomerFeedback);

			///<summary>员工人数</summary>
			public static readonly Field StaffAmount = FindByName(____.StaffAmount);

			///<summary>资产情况</summary>
			public static readonly Field Assets = FindByName(____.Assets);

			///<summary>结款周期</summary>
			public static readonly Field PaymentCycle = FindByName(____.PaymentCycle);

			///<summary>月结算额</summary>
			public static readonly Field MonthlyAmount = FindByName(____.MonthlyAmount);

			///<summary>区域经理评定</summary>
			public static readonly Field ManagerToAssess = FindByName(____.ManagerToAssess);

			///<summary>开票情况</summary>
			public static readonly Field InvoiceSituation = FindByName(____.InvoiceSituation);

			///<summary>奖励情况</summary>
			public static readonly Field RewardSituation = FindByName(____.RewardSituation);

			///<summary>付款方式</summary>
			public static readonly Field TermsOfPayment = FindByName(____.TermsOfPayment);

			///<summary>经办业务员点评</summary>
			public static readonly Field SalesmanComments = FindByName(____.SalesmanComments);

			///<summary>客户协议备案情况</summary>
			public static readonly Field CustomerAgreement = FindByName(____.CustomerAgreement);

			///<summary>公布价方案</summary>
			public static readonly Field SettlementSolutionID = FindByName(____.SettlementSolutionID);

			///<summary>结算折扣</summary>
			public static readonly Field SettlementDiscount = FindByName(____.SettlementDiscount);

			///<summary>客户英文名称2</summary>
			public static readonly Field NameEN2 = FindByName(____.NameEN2);

			private static Field FindByName(String name)
			{
				return Meta.Table.FindByName(name);
			}
		}

		/// <summary>取得客户字段名称的快捷方式</summary>
		public partial class ____ : __
		{
			///<summary>其他地址</summary>
			public const String OtherAddress = "OtherAddress";

			///<summary>物流方向</summary>
			public const String LogisticsDirection = "LogisticsDirection";

			///<summary>成立时间</summary>
			public const String FoundedDate = "FoundedDate";

			///<summary>营业期限(开始)</summary>
			public const String BusinessTermFrom = "BusinessTermFrom";

			///<summary>营业期限(截至)</summary>
			public const String BusinessTermTo = "BusinessTermTo";

			///<summary>营业面积</summary>
			public const String BusinessArea = "BusinessArea";

			///<summary>客户意见</summary>
			public const String CustomerFeedback = "CustomerFeedback";

			///<summary>员工人数</summary>
			public const String StaffAmount = "StaffAmount";

			///<summary>资产情况</summary>
			public const String Assets = "Assets";

			///<summary>结款周期</summary>
			public const String PaymentCycle = "PaymentCycle";

			///<summary>月结算额</summary>
			public const String MonthlyAmount = "MonthlyAmount";

			///<summary>区域经理评定</summary>
			public const String ManagerToAssess = "ManagerToAssess";

			///<summary>开票情况</summary>
			public const String InvoiceSituation = "InvoiceSituation";

			///<summary>奖励情况</summary>
			public const String RewardSituation = "RewardSituation";

			///<summary>付款方式</summary>
			public const String TermsOfPayment = "TermsOfPayment";

			///<summary>经办业务员点评</summary>
			public const String SalesmanComments = "SalesmanComments";

			///<summary>客户协议备案情况</summary>
			public const String CustomerAgreement = "CustomerAgreement";

			///<summary>公布价方案</summary>
			public const String SettlementSolutionID = "SettlementSolutionID";

			///<summary>结算折扣</summary>
			public const String SettlementDiscount = "SettlementDiscount";

			///<summary>客户英文名称2</summary>
			public const String NameEN2 = "NameEN2";
		}

		#endregion 字段名

		#region -- 扩展查询 --

		/// <summary>根据英文名称2查找</summary>
		/// <param name="name">英文名称2</param>
		/// <returns></returns>
		[DataObjectMethod(DataObjectMethodType.Select, false)]
		public static BsdCustomer FindByNameEN2(String name)
		{
			if (Meta.Count > 1000)
			{
				return Find(___.NameEN2, name);
			}
			else // 实体缓存
			{
				return Meta.Cache.Entities.Find(___.NameEN2, name);
			}
		}

		#endregion

		#region -- 业务 --

		#endregion
	}
}